﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace agilecards.Model
{
    public class Card : INotifyPropertyChanged
    {
        public Point Position
        {
            get { return _position; }
            set
            {
                if (value == _position) return;

                _position = value;
                OnPropertyChanged(new PropertyChangedEventArgs("Position"));
            }
        }

        public string Title
        {
            get { return _title; }
            set
            { 
                if (value == _title) return;
            
                _title = value;
                OnPropertyChanged(new PropertyChangedEventArgs("Title"));
            }
        }
        public string Description
        {
            get { return _description; }
            set
            { 
                if (value == _description) return;
            
                _description = value;
                OnPropertyChanged(new PropertyChangedEventArgs("Description"));
            }
        }
        public int Points
        {
            get { return _points; }
            set
            { 
                if (value == _points) return;
            
                _points = value;
                OnPropertyChanged(new PropertyChangedEventArgs("Points"));
            }
        }

        public override string ToString()
        {
            return string.Format("@({0},{1}) {2}", Position.X, Position.Y, Title);
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
            {
                this.PropertyChanged(this, e);
            }
        }
        #endregion

        Point _position;
        string _title;
        string _description;
        int _points;

    }
}
